<template>
	<view class="custom-pikcer">
		<picker @change="change" :value="index" :range="data">
			<view class="uni-input">{{ Number(index) === 0 ? '请设置每日可用时长' : `每日限时${data[index]}`}} </view>
		</picker>
	</view>
</template>

<script setup lang="ts">
	import { useBound } from "@/hooks/useBound.ts"
	const {tipBoundStudent, studentIsEmpt} = useBound();
	const props = defineProps({
		data: {
			type: Array,
			required: true
		},
		index: {
			type: Number,
			required: true
		},
		i: {
			type: Number,
			required: true
		},
	});

	const emits = defineEmits(['onSelect'])
	const change = ({ detail }) => {
		if(studentIsEmpt.value){
			tipBoundStudent();
			return
		}
		// i.value = detail.value;
		emits('onSelect', { index: detail.value, i: props.i })
	}
</script>

<style>
</style>